using SqlSugar;
using IM.Easy.Core.Audit;

namespace IM.Easy.Entity.Workflow
{
    /// <summary>
    /// 任务实例表
    /// </summary>
    [SugarTable("WorkflowTask")]
    public class WorkflowTask : ICreatedAt
    {
        /// <summary>
        /// 任务实例的唯一标识
        /// </summary>
        [SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
        public Guid Id { get; set; }

        /// <summary>
        /// 关联的工作流ID
        /// </summary>
        [SugarColumn(ColumnName = "WorkflowId")]
        public string WorkflowId { get; set; }

        /// <summary>
        /// 对应的步骤ID
        /// </summary>
        [SugarColumn(ColumnName = "StepId")]
        public int StepId { get; set; }

        /// <summary>
        /// 任务当前状态
        /// </summary>
        [SugarColumn(ColumnName = "Status")]
        public TaskStatus Status { get; set; }

        /// <summary>
        /// 被指派的用户ID
        /// </summary>
        [SugarColumn(ColumnName = "AssignedUserId")]
        public long AssignedUserId { get; set; }


        /// <summary>
        /// 发起人（工作流发起者的用户ID）
        /// </summary>
        [SugarColumn(ColumnName = "InitiatorUserId")]
        public long InitiatorUserId { get; set; }

        /// <summary>
        /// 任务备注信息
        /// </summary>
        [SugarColumn(ColumnName = "Comment")]
        public string? Comment { get; set; }

        /// <summary>
        /// 任务创建时间
        /// </summary>
        [SugarColumn(ColumnName = "CreatedAt")]
        public DateTime? CreatedAt { get; set; }

        /// <summary>
        /// 任务完成时间
        /// </summary>
        [SugarColumn(ColumnName = "CompletedTime")]
        public DateTime CompletedTime { get; set; }

    }

    /// <summary>
    /// 任务状态枚举，用于标识任务的当前状态
    /// </summary>
    public enum TaskStatus
    {
        Pending,     // 待处理
        Processing,  // 处理中
        Processed,   // 已处理
        Rejected,    // 拒绝
        Withdrawn    // 撤回
    }


    // 定义任务动作枚举，用于标识审批动作
    public enum TaskAction
    {
        Pass,    // 审批通过
        Reject,  // 驳回
        Forward  // 转发
    }
}
